﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_DSJCJ.BLL
{
    /// <summary>
    /// 问卷题目 逻辑类
    /// </summary>
    public class PaperTopic
    {
        /// <summary>
        /// 问卷题目数据类
        /// </summary>
        private DAL.PaperTopic paperTopicDAL = new DAL.PaperTopic();
        /// <summary>
        /// 构造函数
        /// </summary>
        public PaperTopic()
        {
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-12</date>
        /// </summary>
        public List<ElingOA6_DSJCJ.Model.PaperTopic> GetModelList(decimal paperId)
        {
            DataSet ds = paperTopicDAL.GetList(paperId);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ElingOA6_DSJCJ.Model.PaperTopic GetModel(decimal paperTopicId)
        {
            return paperTopicDAL.GetModel(paperTopicId);
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-12</date>
        /// </summary>
        private List<ElingOA6_DSJCJ.Model.PaperTopic> DataTableToList(DataTable dt)
        {
            List<ElingOA6_DSJCJ.Model.PaperTopic> modelList = new List<ElingOA6_DSJCJ.Model.PaperTopic>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_DSJCJ.Model.PaperTopic model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = paperTopicDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
    
    }
}
